home *** CD-ROM | disk | FTP | other *** search
- ------------------------------------------
- -- Make Your Own "Screen Blank" Program --
- ------------------------------------------
-
- -- change some of these parameters to get weird effects:
- -- (on SVGA this looks pretty good: MODE=261, NLINES=70, NPOINTS=6,
- -- SPACING=12, WIDTH=1, SOLID=0, DELAY=80000 (486-50))
- constant MODE = 261, -- graphics mode -- see euphoria\include\graphics.e
- NLINES = 70, -- number of lines on screen at one time
- NPOINTS = 6, -- number of points in polygons
- SPACING = 12, -- spacing between lines
- WIDTH = 1, -- line width
- SOLID = 0, -- solid polygons? 1 or 0
- DELAY = 0 -- slow it down
- -----------------------------------------------------------------------------
- without type_check
-
- include graphics.e
- include select.e
-
- constant X = 1,
- Y = 2
-
- sequence config
-
- procedure screen_blank()
- integer color, color_step, ncolors
- sequence points, deltas, history
-
- if not select_mode(MODE) then
- puts(1, "couldn't find a good graphics mode\n")
- return
- end if
- config = video_config()
- ncolors = config[VC_NCOLORS]
- color = 1
- color_step = 1
- points = rand(repeat(config[VC_XPIXELS..VC_YPIXELS], NPOINTS)) - 1
- deltas = rand(repeat({2*SPACING-1, 2*SPACING-1}, NPOINTS)) - SPACING
- history = {}
- while 1 do
- if length(history) >= NLINES then
- -- blank out oldest line
- polygon(0, WIDTH, SOLID, history[1])
- history = history[2..NLINES]
- end if
- polygon(color, WIDTH, SOLID, points)
- history = append(history, points)
- points = points + deltas
- -- make vertices change direction at edge of screen
- for j = 1 to NPOINTS do
- if points[j][X] <= 0 or points[j][X] >= config[VC_XPIXELS] then
- deltas[j][X] = -deltas[j][X]
- end if
- if points[j][Y] <= 0 or points[j][Y] >= config[VC_YPIXELS] then
- deltas[j][Y] = -deltas[j][Y]
- end if
- end for
- -- step through the colors
- color = color + color_step
- if color >= ncolors then
- color_step = rand(ncolors)
- color = color_step
- end if
- -- change background color once in a while
- if rand(80) = 1 then
- bk_color(rand(ncolors)-1)
- end if
- -- see if user wants to quit
- if get_key() != -1 then
- return
- end if
- -- slow it down a bit
- for j = 1 to DELAY do
- end for
- end while
- end procedure
-
- screen_blank()
-
- if config[VC_COLOR] then
- graphics_mode(3)
- else
- graphics_mode(7)
- end if
-